﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class 保留物体 : MonoBehaviour
{
    public static 保留物体 静态加载;
    private GameObject 当前物体;
    private void Awake()
    {
        当前物体 = this.gameObject;

        if (静态加载 == null)
        {
            DontDestroyOnLoad(当前物体);
            静态加载 = this;
        }
        else if (静态加载 != null)
        {
            Destroy(当前物体);
        }
    }
    /// <summary>
    /// 删除这个物体
    /// </summary>
    public void DestroyThis()
    {
        if (当前物体 != null)
            Destroy(this.gameObject);
    }
}